from rest_framework import serializers
from ..models.Keyword import Keyword

class KeywordCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Keyword
        fields = ["k", "v"]
    @classmethod
    def get_extra_fields(self):
        return [{"title":"关键词", "dataIndex":"k", "type":"short_string"},
                {"title":"中文翻译", "dataIndex":"v", "type":"short_string"}]
        
        
class TagCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Keyword
        fields = ["k", "v"]
    @classmethod
    def get_extra_fields(self):
        return [{"title":"标签", "dataIndex":"k", "type":"short_string"},
                {"title":"中文翻译", "dataIndex":"v", "type":"short_string"}]
        

class SubjectCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Keyword
        fields = ["k", "v"]
    @classmethod
    def get_extra_fields(self):
        return [{"title":"主题", "dataIndex":"k", "type":"short_string"},
                {"title":"中文翻译", "dataIndex":"v", "type":"short_string"}]  

class KeywordDetailCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Keyword
        fields = ["k", "v", "kt"]
        
        
class KeywordDetailInfoSerializer(serializers.ModelSerializer):
    class Meta:
        model = Keyword
        fields = ["uuid", "k", "v", "kt"]